#pragma once

interface IOwnerDrawMenu;
class CShellSimpleApp : public IUnknown
{
public:
	CShellSimpleApp();

	HRESULT DoModal(HWND hwnd);

	// IUnknown
	STDMETHODIMP QueryInterface(__in REFIID riid, __deref_out void **ppv);

	STDMETHOD_(ULONG, AddRef)();

	STDMETHOD_(ULONG, Release)();

private:
	~CShellSimpleApp();

	static BOOL CALLBACK s_DlgProc(HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam);

	BOOL _DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
	void _OnInitDlg();
	void _OnDestroyDlg();
	void _InitMenuTypeComboBox();
	void _OnRightClick(WPARAM wParam, int x, int y);
	BOOL _OnMeasureItem(__inout MEASUREITEMSTRUCT *pmis);
	BOOL _OnDrawItem(__in DRAWITEMSTRUCT *pdis);
	void _OnSelectMenuItem(int idItem);
	void _SetMenuType(int iMenuType);

	static const int MENUTYPE_STANDARD = 0;
	static const int MENUTYPE_CLASSICOWNERDRAW = 1;
	static const int MENUTYPE_VISTAOWNERDRAW = 2;

	long _cRef;
	HRESULT _hrOleInit;
	HMENU _hmenu;
	HMENU _hmenuContext;
	HWND _hdlg;
	int _iMenuType;
	IOwnerDrawMenu *_pMenu;
};

